import request from './index'

export function login(data) {
  return request({
    url: '/user/login',
    method: 'post',
    data
  })
}

export function logout() {
  return request({
    url: '/user/logout',
    method: 'post'
  })
}

export function getUserInfo(token) {
  return request({
    url: '/user/findOne',
    method: 'get',
    params: { token }
  })
}

export function getUserList(queryParams) {
  return request({
    url: '/user/page',
    method: 'get',
    params: queryParams
  })
}

export function delUserList(ids) {
  return request({
    url: '/user/delByList',
    method: 'delete',
    data: ids
  })
}

export function upsertList(userList) {
  return request({
    url: '/user/batchUpsert',
    method: 'post',
    data: userList
  })
}

export function register(user) {
  return request({
    url: '/user/register',
    method: 'post',
    data: user
  })
}